import translations from './translationsGerman'

export default function customTranslate(template, replacements) {
	replacements = replacements || {}
	template = translations[template] || template
	// eslint-disable-next-line func-names
	return template.replace(/{([^}]+)}/g, function(_, key) {
		let str = replacements[key]
		if (translations[replacements[key]] != null && translations [replacements[key]] !== 'undefined') {
			str = translations[replacements[key]]
		}
		return str || '{' + key + '}'
	})
}